package com.fjxd.user.web;

import com.fjxd.user.pojo.vo.UserVo;
import com.fjxd.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;

    /*
    * 获取单个用户
    * */
    @GetMapping("/{id}")
    public UserVo getUser(@PathVariable Integer id){
        return userService.getUser(id);
    }

    /*
    * 修改密码
    * */
    @PostMapping
    public boolean upPwd(@RequestBody Map<String,Object> map)
    {

        return userService.upPwd(map.get("id"),map.get("newPwd"),map.get("oldPwd"));
    }

}